package cn.kgc.service;

import cn.kgc.mapper.JobsubscriptionMapper;
import cn.kgc.pojo.Jobsubscription;
import cn.kgc.util.Page;
import com.alibaba.dubbo.config.annotation.Service;

import java.io.Serializable;
import java.util.List;
import javax.annotation.Resource;


/**
* 描述： 服务实现层接口
* @author 
* @date 2018/03/05
*/
@Service
public class JobsubscriptionServiceImpl implements JobsubscriptionService{
	@Resource
	private JobsubscriptionMapper jobsubscriptionMapper;
 	
 	/**
    * 描述：根据Id获取Jobsubscription对象
    * @param id
    */
    public Jobsubscription findById(Serializable id){
    	return jobsubscriptionMapper.findById(id);
    }
    /**
    * 描述：获取所有的Jobsubscription对象
    */
    public List<Jobsubscription> findAll(){
    	return jobsubscriptionMapper.findAll();
    }

	@Override
	public List<Jobsubscription> findAllByPushState() {
		return jobsubscriptionMapper.findAllByPushState();
	}

	/**
    * 描述：新增保存Jobsubscription对象
    */
    public int save(Jobsubscription jobsubscription){
    	return  jobsubscriptionMapper.save(jobsubscription);
    }

	/**
    * 描述：根据Id删除Jobsubscription对象
    * @param id
    */
    public int delete(Serializable id){
    	return  jobsubscriptionMapper.delete(id);
    }
	
	/**
    * 描述：更新Jobsubscription对象
    */
    public int update(Jobsubscription jobsubscription){
    	return  jobsubscriptionMapper.update(jobsubscription);
    }
    
    /**
     * 根据不确定的条件，动态查询
     */
    public List<Jobsubscription> query(Object params){
    	return  jobsubscriptionMapper.query(params);
    }
    
    /**
     * 根据不确定的条件，动态分页查询
     */
	public Page queryByPage(String subscriptionTime, Integer index, Integer size){
		Page page=new Page();
		page.setPageIndex(index);
		page.setSize(size);
		page.setTotalCount(jobsubscriptionMapper.getCount(subscriptionTime));
		page.setList(jobsubscriptionMapper.queryByPage(subscriptionTime,index,size));
		return page;
	}

	@Override
	public int getCount(String companyName) {
		return jobsubscriptionMapper.getCount(companyName);
	}

}
